package com.igor.reporting.dao.location;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.igor.reporting.entities.location.Location;

public class LocationDAOImpl implements LocationDAO {

	@Inject
	private Session session;

	public void add(Location l) {
		if (l != null) {
			session.save(l);
		}
	}

	public void delete(Location l) {
		if (l != null) {
			session.delete(l);
		}
	}

	public void update(Location l) {
		if (l != null) {
			session.update(l);
		}
	}

	public Location find(Long id) {
		return (Location) session.load(Location.class, id);
	}

	public List<Location> findAll() {
		return session.createCriteria(Location.class).list();
	}

}
